import service from '@/utils/request.ts'
import { getCurrentClientTime } from '@/utils'

export const fetchWithdrawalOptions = (data: { device: string }) => {
    return service.post('/tWithdrawSetting/withdrawalTier', data)
}

export const fetchWithdrawalRecords = (data: { deviceInfo: string }) => {
    return service.post('/tWithdraw/findWithdrawByDevice', data)
}

interface ApplicationWithdrawal {
    device: string,
    amount: string | number,
    payeeAccount: string
}
export const submitApplicationWithdrawal = (data: ApplicationWithdrawal) => {
    return service.post('/tWithdrawApply/apply', { ...data, applyTime: getCurrentClientTime() })
}

export const submitApplicationInvitedWithdrawal = (data: ApplicationWithdrawal) => {
    return service.post('/tWithdrawApply/applyCashReward', { ...data, applyTime: getCurrentClientTime() })
}